//
//  MessageManagementVC.m
//  YZZX
//
//  Created by Easaa on 15/5/7.
//  Copyright (c) 2015年 Easaa. All rights reserved.
//

#import "MessageManagementVC.h"
#import "ManagementTableView.h"

@interface MessageManagementVC ()<UIScrollViewDelegate>
{
    ManagementTableView  *_InboxTableviewman;
    ManagementTableView  *_OutboxTableviewman;
    UIScrollView         *_BgScrollView;
    
}

@end

@implementation MessageManagementVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
   // self.title = @"收件箱";
    
    UIView  *viewbg = [[UIView alloc]initWithFrame:CGRectMake(0, 0, Dev_ScreenWidth,50)];
    //viewbg.backgroundColor =[UIColor redColor];
    [self.view addSubview:viewbg];
    
    
    //UIImage *bubble = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bubble" ofType:@"png"]];
//    UIImage *bubble = [UIImage imageNamed:@"message_tab_selected.9"];
//    UIImageView *bubbleImageView = [[UIImageView alloc] initWithImage:[bubble stretchableImageWithLeftCapWidth:65/2 topCapHeight:32]];
//    
    
    
    UIButton *InboxButton = [UIButton buttonWithType:UIButtonTypeCustom];
    InboxButton.tag = 2000 ;
    InboxButton.frame = CGRectMake(0, 0, Dev_ScreenWidth/2, 50);
    [InboxButton addTarget:self action:@selector(tabBarButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
    [InboxButton.layer setMasksToBounds:YES];
    [InboxButton.layer setCornerRadius:2]; //设置矩圆角半径
    [InboxButton.layer setBorderWidth:0];   //边框宽度
    [InboxButton setTitle:@"收件箱" forState:UIControlStateNormal];
    [InboxButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    //[InboxButton setBackgroundImage: forState:<#(UIControlState)#>]
    //[InboxButton setTintColor:[UIColor blackColor]];
    //InboxButton.backgroundColor =RGBCOLOR(252, 78, 125);
    
    
    [InboxButton.layer setMasksToBounds:YES];
    [InboxButton.layer setCornerRadius:0]; //设置矩圆角半径
    [InboxButton.layer setBorderWidth:0.5];   //边框宽度
    CGColorSpaceRef colorSpace =CGColorSpaceCreateDeviceRGB();
    CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 0, 0, 0, 0.5 });
    [InboxButton.layer setBorderColor:colorref];//边框颜色
    
    
    
    [viewbg addSubview:InboxButton];

    
    
    
    UIButton *OutboxButton = [UIButton buttonWithType:UIButtonTypeCustom];
    OutboxButton.tag = 2001 ;
    OutboxButton.frame = CGRectMake(Dev_ScreenWidth/2, 0, Dev_ScreenWidth/2, 50);
    [OutboxButton addTarget:self action:@selector(tabBarButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
    [OutboxButton.layer setMasksToBounds:YES];
    [OutboxButton.layer setCornerRadius:2]; //设置矩圆角半径
    [OutboxButton.layer setBorderWidth:0];   //边框宽度
    [OutboxButton setTitle:@"发件箱" forState:UIControlStateNormal];
    [OutboxButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    // [OutboxButton setTintColor:[UIColor blackColor]];
   // OutboxButton.backgroundColor =RGBCOLOR(252, 78, 125);
    
    
    
    [OutboxButton.layer setMasksToBounds:YES];
    [OutboxButton.layer setCornerRadius:0]; //设置矩圆角半径
    [OutboxButton.layer setBorderWidth:0.5];   //边框宽度
//    CGColorSpaceRef colorSpace =CGColorSpaceCreateDeviceRGB();
//    CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 0, 0, 0, 0.5 });
    [OutboxButton.layer setBorderColor:colorref];//边框颜色

    
    
    [viewbg addSubview:OutboxButton];


    // UIScrollView创建
    _BgScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 50, Dev_ScreenWidth, Dev_ScreenHeight-64-30)];
    _BgScrollView.contentSize =CGSizeMake(Dev_ScreenWidth*2, Dev_ScreenHeight-64-30);
    _BgScrollView.delegate =self;
    //_BgScrollView.bounces = NO;
    [_BgScrollView setPagingEnabled:YES];
    _BgScrollView.showsHorizontalScrollIndicator = NO;
    _BgScrollView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_BgScrollView];
   
    _InboxTableviewman = [[ManagementTableView alloc]initWithActionFantionFram:CGRectMake(0, 0, Dev_ScreenWidth, Dev_ScreenHeight-64-30) tyMessagebox:@"Inbox"];
    _InboxTableviewman.DelegatMessage = self;
    [_BgScrollView addSubview:_InboxTableviewman];
    
    
    _OutboxTableviewman = [[ManagementTableView alloc]initWithActionFantionFram:CGRectMake(Dev_ScreenWidth, 0, Dev_ScreenWidth, Dev_ScreenHeight-64-30) tyMessagebox:@"Outbox"];
    _OutboxTableviewman.DelegatMessage = self;
    [_BgScrollView addSubview:_OutboxTableviewman];
    
    


    
    
}

-(void)tabBarButtonClicked:(UIButton *)But
{
    if(But.tag == 2000)
    {
        _BgScrollView.contentOffset = CGPointMake(0, 0);

        
    
    }else if (But.tag == 2001)
    {
    
        _BgScrollView.contentOffset = CGPointMake(Dev_ScreenWidth, 0);
       
    }



}



@end
